package com.tjoydoorsystem;

import android.app.Application;
import android.content.Intent;

import com.tjoydoorsystem.bluetooth.BluetoothUtil;
import com.tjoydoorsystem.main.WelcomeActivity;

/**
 * Author：hebin on 2016/10/22 0022
 * Annotations：初始化APP配置类
 */
public class MyApplication extends Application implements Thread.UncaughtExceptionHandler {

    @Override
    public void onCreate() {
        super.onCreate();

        //蓝牙服务链接初始化
        BluetoothUtil.getInstance().initBluetooth(this);
    }


    @Override
    public void uncaughtException(Thread thread, Throwable throwable) {

        // 重启app ..上传日志等...
        Intent intent = new Intent(this, WelcomeActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        this.startActivity(intent);
        android.os.Process.killProcess(android.os.Process.myPid());
    }
}
